import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetBoardLabelList_ {
  /**
   * @description name
   */
  name?: string;
}
export interface PutBoardLabelById_ {
  /**
   * @description 看板标签的id
   */
  id: number;
}
export interface DeleteBoardLabelById_ {
  /**
   * @description 看板标签的id
   */
  id: number;
}

export class BoardLable {
  /**
   * 新建看板标签
   *
   * @tags 看板标签模块
   * @request POST: /board-label
   * @secure
   */
  postBoardLabel = (boardLabelDTO: defs.BoardLabelDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/board-label`,
      method: "POST",
      data: boardLabelDTO,
      ...params,
    });

  /**
   * 按名称模糊查询看板标签列表
   *
   * @tags 看板标签模块
   * @request GET: /board-label/list
   * @secure
   */
  getBoardLabelList = (query: { name?: string } | GetBoardLabelList_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListBoardLabelVO>({
      url: `/board-label/list`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 编辑看板标签
   *
   * @tags 看板标签模块
   * @request PUT: /board-label/{id}
   * @secure
   */
  putBoardLabelById = (
    { id }: { id: number } | PutBoardLabelById_,
    boardLabelDTO: defs.BoardLabelDTO,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityString>({
      url: `/board-label/${id}`,
      method: "PUT",
      data: boardLabelDTO,
      ...params,
    });

  /**
   * 删除看板标签
   *
   * @tags 看板标签模块
   * @request DELETE: /board-label/{id}
   * @secure
   */
  deleteBoardLabelById = ({ id }: { id: number } | DeleteBoardLabelById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/board-label/${id}`,
      method: "DELETE",
      ...params,
    });
}

export default new BoardLable();
